package com.jml.自定义注解;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Main {

	public static void main(String[] args) {
		Class<Student> studentClass = Student.class;
		//通过反射获取类上面注解
		Table declaredAnnotation = studentClass.getDeclaredAnnotation(Table.class);
		//获取所有的属性
		Field[] declaredFields = studentClass.getDeclaredFields();
		StringBuffer sf = new StringBuffer("select ");
		for (int i = 0; i < declaredFields.length; i++) {
			//获取属性上的注解
			Propety propety = declaredFields[i].getDeclaredAnnotation(Propety.class);
			sf.append(propety.name());
			if(i<(declaredFields.length-1)){
				sf.append(" , ");
			}
		}
		sf.append(" from " + declaredAnnotation.value());
		System.out.println(sf);
	}

}
